#include <iostream>
#include <vector>
#include <set>

#ifndef SUDOKU_HPP
#define	SUDOKU_HPP

#include "field.hpp"
#include "random.hpp"

#include <log4cpp/Category.hh>
#include <log4cpp/FileAppender.hh>
#include <log4cpp/PatternLayout.hh>

class Field;
class Sudoku;

/* --------------------------------------------------------------- */
class Sudoku {
	public:
		Sudoku();
		Sudoku(int[9][9]);
		Sudoku (Sudoku *);
		Field * getField(int i, int j);
		void fill();											//init sheet game
		void print();											//print sudoku
		void reset();											//reset sudoku - fill 0
		std::vector<Sudoku *> * findSolution(int);						//return solution
		int getTab();											//export sudoku to int[9][9]
		bool setTab(int[9][9]);									//import sudoku from int[9][9]; return true if tab is valid
		bool setField(int v, int row, int col);
		static int stepCount;
		void createNeigSet(int r, int c);
	private:
		const static int ROWS = 9;
		const static int COLUMNS = 9;
		Field * tab[ROWS][COLUMNS];
		//std::vector<Sudoku*> listOfSolutions;					//current list of solutions
		Random random;											//random class
		void solutionNextStep(std::vector<Sudoku*>*, int, Field*);						//recursive finding of solutions
		int getFreeFields();									//get amount of free fields
		bool valid();											//check if no conflicts
		Field * getNextField(Field * f);
		int maxSol;
};
/* --------------------------------------------------------------- */
#endif
